package com.example.project.projectspringcloud.common;

import com.example.project.projectspringcloud.utils.PropertyUtil;

/**
 * Common Constants
 *
 * @author Christopher Jones
 * @date 2018-08-13 12:00
 */
public class Constants {

    /**
     * 属性文件名称
     */
    public static final String PROPERTY_FILE = "project";

    /**
     * 属性文件对象
     */
    public static PropertyUtil propertyUtil = PropertyUtil.getInstance(PROPERTY_FILE);

    /**
     * 网站访问路径
     */
    public static String contextPath = propertyUtil.getProperty("contextPath");

    /**
     * 静态文件服务器
     */
    public static String staticServer = propertyUtil.getProperty("staticServer");

    /**
     * 项目根路径
     */
    public static String rootPath = propertyUtil.getProperty("rootPath");

    /**
     * 上传服务器
     */
    public static String uploadServer = propertyUtil.getProperty("uploadServer");

    /**
     * 网站域
     */
    public static final String MYDOMAIN = propertyUtil.getProperty("mydomain");

    /**
     * 视频地址缓存头
     */
    public static final String VIDEO_CACHE_PREFIX = "video_key_";

    /**
     * 用户菜单list 对应角色
     */
    public static final String MENU_LIST_OF_ROLE_PREFIX = "menu_list_of_role_";

    /**
     * 验证码
     */
    public static final String VALIDATE_CODE = "validate_code_";

    /**
     * 修改手机号验证码
     */
    public static final String VALIDATE_CODE_OF_MODIFY = "validate_code_of_modify_";

    /**
     * 注册短信验证码
     */
    public static final String SMS_VALIDATE_CODE_OF = "sms_validate_code_of";

    /**
     * 短信验证码上次获取的记录
     */
    public static final String SMS_VALIDATE_CODE_TIME_OF = "sms_validate_code_time_of";

    /**
     * 短信验证码冷确时间未到
     */
    public static final String GET_SMS_FAILED_PLEASE_LATER = "GET_SMS_FAILED_PLEASE_LATER";

    /**
     * 私人订制页面是否显示浮窗
     */
    public static final String FLOAT_WINDOW_VISIBLE = "float_window_visible_";

    /**
     * 订单套餐缓存前缀
     */
    public static final String ORDER_COMBO_PREFIX = "order_combo_";

    /**
     * 提示
     * ==============================================================================
     */
    public class Tip {

        /**
         * 请输入手机号
         */
        public static final String PLEASE_ENTER_MOBILE = "PLEASE_ENTER_MOBILE";

        /**
         * 请输入昵称
         */
        public static final String PLEASE_ENTER_NICKNAME = "PLEASE_ENTER_NICKNAME";

        /**
         * 请输入验证码
         */
        public static final String PLEASE_ENTER_VALIDATE_CODE = "PLEASE_ENTER_VALIDATE_CODE";

        /**
         * 手机号格式错误
         */
        public static final String MOBILE_FORMAL_ERROR = "MOBILE_FORMAL_ERROR";

        /**
         * 密码格式错误
         */
        public static final String PASSWORD_FORMAL_ERROR = "PASSWORD_FORMAL_ERROR";

        /**
         * 验证码不能为空
         */
        public static final String VALIDATE_CODE_CAN_NOT_BE_NULL = "VALIDATE_CODE_CAN_NOT_BE_NULL";

        /**
         * 再次密码不一致
         */
        public static final String THE_TWO_PASSWORD_ARE_DIFFERENT = "THE_TWO_PASSWORD_ARE_DIFFERENT";

        /**
         * 手机号注册信息已存在
         */
        public static final String ACCOUNT_MOBILE_EXIST = "ACCOUNT_MOBILE_EXIST";

        /**
         * 手机号账号信息不存在
         */
        public static final String ACCOUNT_MOBILE_NOT_EXIST = "ACCOUNT_MOBILE_NOT_EXIST";

        /**
         * 短信验证码错误
         */
        public static final String SMS_VALIDATE_CODE_DIFFERENT = "SMS_VALIDATE_CODE_DIFFERENT";

        /**
         * 微信
         */
        public static final String WECHAT_CNA_NOT_BE_NULL = "WECHAT_CNA_NOT_BE_NULL";

        /**
         * 以下订单创建错误信息 |||||
         * 优惠券不存在
         */
        public static final String DISCOUNT_COUPON_NOT_EXIST = "DISCOUNT_COUPON_NOT_EXIST";

        /**
         * 请选择拍摄作品类型
         */
        public static final String PLEASE_CHOOSE_VIDEO_TYPE = "PLEASE_CHOOSE_VIDEO_TYPE";

        /**
         * 请选择拍摄地点
         */
        public static final String PLEASE_CHOOSE_LOCATION = "PLEASE_CHOOSE_LOCATION";

        /**
         * 请选择套餐
         */
        public static final String PLEASE_CHOOSE_COMBO = "PLEASE_CHOOSE_COMBO";

        /**
         * 请选择开始拍摄时间
         */
        public static final String PLEASE_CHOOSE_EXECUTE_DATE = "PLEASE_CHOOSE_EXECUTE_DATE";

        /**
         * 订单评价已存在
         */
        public static final String ORDER_EVALUATE_ALREADY_EXIST = "ORDER_EVALUATE_ALREADY_EXIST";

        /**
         * 发票信息已存在
         */
        public static final String ORDER_RECEIPT_ALREADY_EXIST = "ORDER_RECEIPT_ALREADY_EXIST";
    }

    /**
     * 消息提示
     * ==============================================================================
     */
    public class Message {

        public static final String PARAM_INVALID = "参数错误";

        public static final String USER_ACCOUNT_NOT_FOUND = "用户名不存在";

        public static final String DELETE_SUCCESS = "删除成功";

        public static final String DELETE_FAILED = "删除失败";

        public static final String SAVE_FAILED = "保存失败";

        public static final String SAVE_SUCCESS = "保存成功";

        public static final String MODIFY_SUCCESS = "MODIFY_SUCCESS";

        public static final String MODIFY_FAILED = "MODIFY_FAILED";

        /**
         * 收藏失败
         */
        public static final String COLLECT_FAILED = "COLLECT_FAILED";

        /**
         * 验证码错误
         */
        public static final String VALIDATE_ERROR = "VALIDATE_ERROR";

        public static final String GET_VALIDATE_CODE_ERROR = "GET_VALIDATE_CODE_ERROR";

        public static final String OPERATION_SUCCESS = "OPERATION_SUCCESS";

        public static final String OPERATION_FAILED = "OPERATION_FAILED";

        /**
         * 密码错误
         */
        public static final String PASSWORD_ERROR = "PASSWORD_ERROR";

        /**
         * 信息不存在
         */
        public static final String INFORMATION_DOES_NOT_EXIST = "INFORMATION_DOSE_NOT_EXIST";

        /**
         * 作品信息不存在
         */
        public static final String VIDEO_INFO_DOES_NOT_EXIST = "VIDEO_INFO_DOES_NOT_EXIST";

        /**
         * 摄影师不存在
         */
        public static final String PHOTO_GRAPHER_DOES_NOT_EXIST = "PHOTO_GRAPHER_DOES_NOT_EXIST";

        /**
         * 编剧不存在
         */
        public static final String SCRIPT_WRITER_DOES_NOT_EXIST = "SCRIPT_WRITER_DOES_NOT_EXIST";

        /**
         * 套餐不存在
         */
        public static final String COMBO_DOES_NOT_EXIST = "COMBO_DOES_NOT_EXIST";

        /**
         * 订单不存在
         */
        public static final String ORDER_DOES_NOT_EXIST = "ORDER_DOES_NOT_EXIST";
    }

    /**
     * 系统提示
     * ==============================================================================
     */
    public class SystemMessage {

        /**
         * 系统异常
         */
        public static final String SYSTEM_ERROR = "SYSTEM_ERROR";

        /**
         * 系统配置异常
         */
        public static final String SYSTEM_CONFIG_ERROR = "SYSTEM_CONFIG_ERROR";
    }

    /**
     * 系统配置类型
     * ==============================================================================
     */
    public class SysConfigType {

        /**
         * 系统配置短信平台
         */
        public static final String SYS_CONFIG_TYPE_SMS_PLATFORM = "sms-platform";

        /**
         * 系统配置短信模板
         */
        public static final String SYS_CONFIG_TYPE_SMS_TEMPLATE = "sms-template";

        /**
         * 系统配置支付宝支付配置
         */
        public static final String SYS_CONFIG_TYPE_PAY_ALI = "ali-pay";

        /**
         * 系统配置微信支付配置
         */
        public static final String SYS_CONFIG_TYPE_PAY_WECHAT = "wechat-pay";

        /**
         * 系统配置普通用户可用系统配置
         */
        public static final String SYS_CONFIG_NORMAL_USER = "normal-user";

        /**
         * 系统配置第三方QQ登录是否可用 ON/OFF
         */
        public static final String SYS_CONFIG_THIRD_PART_LOGIN_QQ_ON_OFF = "third-part-login-qq-on-off";

        /**
         * 系统配置第三方WeChat登录是否可用 ON/OFF
         */
        public static final String SYS_CONFIG_THIRD_PART_LOGIN_WECHAT_ON_OFF = "third-part-login-wechat-on-off";

        /**
         * 系统配置第三方Sina weibo登录是否可用 ON/OFF
         */
        public static final String SYS_CONFIG_THIRD_PART_LOGIN_SINAWEIBO_ON_OFF = "third-part-login-sinaweibo-on-off";

        /**
         * 系统配置第三方QQ登录信息
         */
        public static final String SYS_CONFIG_THIRD_PART_LOGIN_QQ = "third-part-login-qq";

        /**
         * 系统配置第三方WeChat登录信息
         */
        public static final String SYS_CONFIG_THIRD_PART_LOGIN_WECHAT = "third-part-login-wechat";

        /**
         * 系统配置第三方Sina weibo登录信息
         */
        public static final String SYS_CONFIG_THIRD_PART_LOGIN_SINAWEIBO = "third-part-login-sinaweibo";
    }

    /**
     * 订单
     * ==============================================================================
     */
    public static class Order {

        /**
         * 购物车cookie
         */
        public static final String SHOP_CART = PropertyUtil.getInstance("memtimes").getProperty("memfix") + "inxedu_shopcart";

        /**
         * 返回值
         */
        public static final String RESCODE = "rescode";

        /**
         * 返回信息
         */
        public static final String RESMSG = "msg";

        /**
         * 成功信息
         */
        public static final String SUCCESS = "success";

        /**
         * 失败信息
         */
        public static final String FALSE = "false";

        /**
         * 返回值，判断是否给支付宝等返回成功信息,此值为success代表成功充值了 给银行返回成功信息
         */
        public static final String BANKCODE = "bankcode";

        /**
         * 支付宝常量 字符编码格式 目前支持 gbk 或 utf-8
         */
        public static final String ALIPAY_INPUT_CHARSET = "utf-8";

        /**
         * 支付宝常量 支付方式, 跳转支付
         */
        public static final String PAY_METHOD_DIRECT = "directPay";

        /**
         * 支付宝常量 支付方式, 银行卡支付
         */
        public static final String PAY_METHOD_BANK = "bankPay";

        /**
         * 签名方式 不需修改
         */
        public static final String ALIPAY_SIGN_TYPE = "MD5";

        /**
         * 公司英文名字，订单中显示
         */
        public static final String COMPANY_NAME = "巨桃游娱";
    }

    /**
     * 订单状态
     */
    public static class OrderStatus {

        /**
         * 已支付
         */
        public static int PAID = 1;

        /**
         * 未支付
         */
        public static int NOT_PAID = 2;

        /**
         * 取消
         */
        public static int CANCEL = 3;
    }

    /**
     * 订单名称
     */
    public enum OrderName {

        PRIVATE("私人定制作品", 1),

        SAME_STYLE("拍摄同款作品", 2);

        // 成员变量
        private String name;

        private int index;

        // 构造方法
        OrderName(String name, int index) {
            this.name = name;
            this.index = index;
        }

        public static String getName(int index) {
            for (OrderName on : OrderName.values()) {
                if (on.getIndex() == index) {
                    return on.name;
                }
            }
            return null;
        }

        public int getIndex() {
            return index;
        }
    }

    /**
     * 微信消息类型
     * ==============================================================================
     */
    public class WeChatMessageType {

        /**
         * 常规回复类型：被关注时
         */
        public static final String ADD = "add";

        /**
         * 默认回复
         */
        public static final String TOLERATE = "tolerate";

        /**
         * 消息类型：文本
         */
        public static final String TEXT = "text";

        /**
         * 消息类型：图文
         */
        public static final String NEWS = "news";

        /**
         * 消息类型：图片
         */
        public static final String IMAGE = "image";

        /**
         * 消息类型：链接
         */
        public static final String LINK = "link";

        /**
         * 消息类型：推送
         */
        public static final String EVENT = "event";

        /**
         * 事件类型：订阅
         */
        public static final String SUBSCRIBE = "subscribe";

        /**
         * 事件类型：取消订阅
         */
        public static final String UNSUBSCRIBE = "unsubscribe";

        /**
         * 事件类型：自定义菜单点击事件
         */
        public static final String CLICK = "CLICK";
    }

    /**
     * 第三方登录类型
     * ==============================================================================
     */
    public enum ThirdPartType {
        /**
         * QQ
         */
        QQ,
        /**
         * WeChat
         */
        WECHAT,
        /**
         * Sina Weibo
         */
        SINAWEIBO
    }

    public enum PayMethod {
        /**
         * Alipay
         */
        ALIPAY,
        /**
         * WeChat,
         */
        WECHAT
    }

    /**
     * 用户注册来源
     * ==============================================================================
     */
    public enum RegisterType {
        /**
         * Web
         */
        WEB,
        /**
         * 管理员添加
         */
        ADMINADD,
        /**
         * 第三方
         */
        THIRDPART
    }

    /**
     * 用户角色
     * ==============================================================================
     */
    public enum UserRole {
        /**
         * Admin
         */
        ROLE_ADMIN,
        /**
         * User
         */
        ROLE_USER,
        /**
         * Guest
         */
        ROLE_GUEST,
        /**
         * Photo Grapher
         */
        ROLE_PHOTOGRAPHER,
        /**
         * Script Writer
         */
        ROLE_SCRIPTWRITER,
        /**
         * Editor
         */
        ROLE_EDITOR,
    }

    /**
     * 系统标志
     * ==============================================================================
     */
    public enum SystemFlag {
        /**
         * ON
         */
        ON,
        /**
         * OFF
         */
        OFF
    }

    /**
     * 标点常量
     */
    public class Punctuation {

        public static final String COMMA = ",";
    }

    /**
     * 本站内容类型
     */
    public class ContentType {

        /**
         * 用户
         */
        public static final int TYPE_USER = 1;

        /**
         * 视频/作品
         */
        public static final int TYPE_VIDEO = 2;
    }

    /**
     * 收藏操作类型
     */
    public class CollectOperation {

        /**
         * 喜欢
         */
        public static final int OPERATION_LIKE = 1;

        /**
         * 收藏
         */
        public static final int OPERATION_COLLECT = 2;
    }
}
